﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PhotoMgr.src.common;
using System.Windows.Forms;
using PhotoMgr.src.database;

namespace PhotoMgr.src.gui.category
{
    class CategoryList : ListBase
    {
        public CategoryList(string title, FormAction action)
            : base(title, action)
        {
            DataColumns = new DataGridViewColumn[] 
            { 
                Global.GenColumn("Tên thể loại"                 , "CategoryName").SetSizeMode(DataGridViewAutoSizeColumnMode.Fill),
                Global.GenColumn("Ký tự viết tắt"               , "CategoryAbbriaviate"),
                Global.GenColumn("Tình trạng"               , "StatusName"),
            };

            SearchControls = new SearchBox[]{                
                new SearchBox().initTextBox("Tên thể loại=CategoryName"),
                new SearchBox().initTextBox("Ký tự viết tắt=CategoryAbbriaviate"),
                new SearchBox().initComboBox("Tình trạng=Status", new SearchBox.InitStatusComboBoxDelegate(Global.InitStatusCombobox), Global.StatusType.Status, true ),
            };

            OwnerSearchBoxIndex = -1;
            SelectedColumnName = "CategoryID";
            SearchFunction = DBManager.Search_Category;
            DetailFormType = typeof(PhotoMgr.src.gui.category.CategoryDetaill);
        }
    }
}
